package com.system.connect.springboot_flowers.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;

@Data
@TableName("order_item")
public class OrderItem {
    @TableId(type = IdType.AUTO)
    private Long id;

    @NotNull(message = "订单ID不能为空")
    private Long orderId;

    @NotNull(message = "订单编号不能为空")
    private String orderNo;

    @NotNull(message = "商品ID不能为空")
    private Long itemId;

    @NotNull(message = "商品名称不能为空")
    private String itemName;

    private String itemImage;

    private String itemSpec;

    @NotNull(message = "商品单价不能为空")
    @Min(value = 0, message = "商品单价必须大于0")
    private BigDecimal price;

    @NotNull(message = "商品数量不能为空")
    @Min(value = 1, message = "商品数量必须大于0")
    private Integer quantity;

    @NotNull(message = "商品总价不能为空")
    @Min(value = 0, message = "商品总价必须大于0")
    private BigDecimal totalPrice;
}
